// Nishant's Code
#include <bits/stdc++.h>
using namespace std;
#define T \
ll no_of_testcases; \
cin >> no_of_testcases; \
f(curr_testcase, 1, no_of_testcases + 1)
#define ll long long
#define ld long double
const ll M = 1e9 + 7;
const ll M1 = 998244353;
const ll inf = 1e18 + 10;
const ll inf_ = -1e18 - 10;
ll max(ll x, ll y) { return x > y ? x : y; }
ll min(ll x, ll y) { return x < y ? x : y; }
ll gcd(ll x, ll y)
{
if (y == 0)
return x;
return gcd(y, x % y);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }
#define bp __builtin_popcountll
#define bclz __builtin_clzll
#define bctz __builtin_ctzll
#define f(i, m, n) for (ll i = (ll)m; i < (ll)n; i++)
#define f_(i, n, m) for (ll i = (ll)n; i >= (ll)m; i--)
#define fa(i, x) for (auto i : x)
#define vll vector<ll>
#define vvll vector<vll>
#define vb vector<bool>
#define vvb vector<vb>
#define pll pair<ll, ll>
#define ppll pair<ll, pll>
#define ff first
#define ss second
#define vpll vector<pll>
#define v(x) vector<x>
#define p(x, y) pair<x, y>
#define all(x) x.begin(), x.end()
#define um unordered_map
#define us unordered_set
#define ms multiset
#define pqllMaxHeap priority_queue<ll>
#define pqllMinHeap priority_queue<ll, vector<ll>, greater<ll>>
#define pqpll priority_queue<ppll, vector<ppll>, greater<ppll>>
#define pq(x) priority_queue<x, vector<x>, greater<x>>
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define acc accumulate
#define in insert
#define clr clear
#define nl cout << "\n";
void solve()
{
//CODE HERE
ll k;
cin >> k;
vll c(k);
f(i, 0, k)
{
cin >> c[i];
}
// As nCr= n-1Cr + n-1Cr-1
vvll nCr(1005, vll(1005, 0));
nCr[0][0] = 1;
f(i, 1, 1005)
{
nCr[i][0] = 1;
f(j, 1, i + 1)
{
nCr[i][j] = (nCr[i - 1][j] + nCr[i - 1][j - 1]) % M;
}
}
ll tot = 0;
ll ans = 1;
f(i, 0, k)
{
tot += c[i];
ans = (ans * nCr[tot - 1][c[i] - 1]) % M;
}
cout << ans;
nl
}
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
solve();
}
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |